package jt.classic.app.gdzc.impl;

import jt.classic.app.gdzc.GdzcTemplate;

import jt.classic.system.AbstractIBigObject;
import jt.classic.system.user.IUser;

import org.limp.mine.annex.AnnexInfo;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * 资产模板接口实现类
 *
 * @author mido
 *
 */
public class GdzcTemplateImpl extends AbstractIBigObject implements GdzcTemplate {
	/**通用属性*/
    public final static String PROP_COMMON = "COMMON";
    /**基础属性*/
    public final static String PROP_BASE = "BASE";
    /**配置属性*/
    public final static String PROP_CONFIG = "CONFIG";
    /**财务属性*/
    public final static String PROP_FINANCE = "FINANCE";
    /**维保属性*/
    public final static String PROP_MAINTEN = "MAINTEN";
    
    private String createtime;
    private IUser user;
    private String userid;
    private String username;
    private String groupid;
    private String groupname;
    private String desc;
    private int status;
    private AnnexInfo[] printannex;
    private String typeid;
    private String typename;
    private String typecode;

    public IUser iuser() {
        return this.user;
    }

    public boolean emptyItem(String itemType) {
        // TODO Auto-generated method stub
        List list = (List) this.info.get(itemType);

        return ((list == null) || list.isEmpty());
    }

    public String icreatetime() {
        // TODO Auto-generated method stub
        return this.createtime;
    }

    public String idesc() {
        // TODO Auto-generated method stub
        return this.desc;
    }

    public String igroupid() {
        // TODO Auto-generated method stub
        return this.groupid;
    }

    public String igroupname() {
        // TODO Auto-generated method stub
        return this.groupname;
    }

    public AnnexInfo[] iprinttemplates() {
        // TODO Auto-generated method stub
        return this.printannex;
    }

    public int istatus() {
        // TODO Auto-generated method stub
        return this.status;
    }

    public List items(String itemType) {
        // TODO Auto-generated method stub
        List list = (List) this.info.get(itemType);

        return list;
    }

    public String itypeid() {
        // TODO Auto-generated method stub
        return this.typeid;
    }

    public String itypename() {
        // TODO Auto-generated method stub
        return this.typename;
    }
    
    public String itypecode(){
    	return this.typecode;
    }

    public String iuserid() {
        // TODO Auto-generated method stub
        return this.userid;
    }

    public String iusername() {
        // TODO Auto-generated method stub
        return this.username;
    }

    public void reload(Map map) {
        if (map != null) {
            this.info = map;

            this.bigoid = (String) map.get("ID");
            this.bigoname = (String) map.get("TNAME");
            this.createtime = (String) map.get("TDATE");
            this.desc = (String) map.get("TDESC");
            this.groupid = (String) map.get("GROUPID");
            this.groupname = (String) map.get("GROUPNAME");
            this.printannex = (AnnexInfo[]) map.get("ALLFREE");
            this.status = Integer.parseInt((String) map.get("TSTATUS"));
            this.typeid = (String) map.get("TYPEID");
            this.typename = (String) map.get("TYPENAME");
            this.user = (IUser) map.get("IUSER");
            this.userid = (String) map.get("USERID");
            this.username = (String) map.get("USERNAME");
            this.typecode = (String) map.get("TYPECODE");
        }
    }
}
